<template>
	<view class="container">
		<view class="shower">
			<theowner :Info="allGoods"></theowner>
			<!-- <luanqing-empty show="true" text="没有更多数据啦" textColor="#000"></luanqing-empty> -->
			<uni-section title="指定加载图标样式 - 环形" type="line" @click="onchange">
				<uni-load-more iconType="circle" :status="status" />
			</uni-section>
		</view>

	</view>
</template>

<script>
	import theowner from '@/compoment/theowner/theowner.vue'
	import piker from '@/compoment/Picker/Picker.vue'
	import {
		apiGetAllPosts
	} from '@/utils/request/api.js'
	export default {
		data() {
			return {
				status: 'more',
				bg: 1,
				allGoods: [],
				pickallGoods: [],
				params: {
					id: 3,
					pageNum: 1,
					pageSize: 10
				}
			}
		},
		components: {
			theowner,
			piker
		},
		//底部刷新
		onReachBottom() {
			// 让页码值自增 +1
			console.log("已经到底咯，刷新下一页");
			this.params.pageNum += 1
			// 重新获取列表数据
			apiGetAllPosts(this.params).then(res => {

				this.allGoods.push(...res.data)
				console.log(res.data);
				if (res.data.length === 0) {
					this.status = 'nomore'
					// console.log(this.status);
					console.log("已经到底");
				}
				// console.log(newLists);
			}).catch(err => {
				console.log(err);
			})
		},
		onPullDownRefresh() {
			console.log('触发了下拉刷新')
			setTimeout(() => {
				uni.stopPullDownRefresh()
				this.$router.go(0)
			}, 500)
		},
		onLoad() {
			apiGetAllPosts(this.params).then(res => {
				console.log(res);
				this.allGoods = res.data
				console.log(this.allGoods);


				// console.log(newLists);
			}).catch(err => {
				console.log(err);
			})
		},
		methods: {
			changbg(e) {
				console.log(e);
				this.bg = e
			}
		}
	}
</script>

<style lang="less" scoped>
	page {
		background-color: #f4f4f4;
	}
	.container {
		width: 100vw;
		height: 100vh;
		background-color: #f4f4f4;
	}

	.search-bar {
		width: 100%;
		height: 100rpx;
		margin-top: 3%;

	}

	.search-bar-box {
		display: flex;
		margin: 0 auto;
		width: 650rpx;
		height: 70rpx;
		border: 5rpx solid #00a8cc;
		border-radius: 50rpx;
	}

	.search-span {
		width: 15%;
		height: 56rpx;
		margin-top: 6rpx;
		margin-left: 30rpx;
	}

	.search-text {
		width: 100%;
		margin-top: 10rpx;
		margin-left: 10rpx;
		font-size: 30rpx;
		color: #7f7f81;
	}

	.search-btn {
		background-color: #00a8cc;
		/* Green */
		color: white;
		text-align: center;
		display: inline-block;
		font-size: 35rpx;
		width: 240rpx;
		height: 76rpx;
		line-height: 65rpx;
		border-radius: 30rpx;
		letter-spacing: 3rpx;
		margin-right: -5px;
		margin-top: 0rpx;

	}

	.lostor {
		margin: 10px auto;

		.loster {
			display: inline-block;
			width: 30%;
			height: 40px;
			line-height: 40px;
			// background-color: #f8ffca;
			border: 1px solid #ccc;
			text-align: center;
			margin-left: 15%;
			border-radius: 30px;
		}

		.fouder {
			display: inline-block;
			width: 30%;
			height: 40px;
			line-height: 40px;
			// background-color: #f8ffca;
			border: 1px solid #ccc;
			text-align: center;
			margin-left: 5%;
			border-radius: 30px;
		}
	}

	.bg1 {
		background-color: #a0eee1;
	}
</style>
